//package com.qingmeng.applyjob.portal.service.impl;
//
//import com.qingmeng.applyjob.mapper.*;
//import com.qingmeng.applyjob.model.*;
//import com.qingmeng.applyjob.portal.model.dto.ImproveResumeParamOUT;
//import com.qingmeng.applyjob.portal.service.ResumeService;
//import com.qingmeng.applyjob.portal.utils.SecurityUtils;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
//import java.util.List;
//
//@Service
//public class ResumeServiceImplOUT implements ResumeService {
//
//    private static final Logger logger = LoggerFactory.getLogger(ResumeServiceImplOUT.class);
//
//    @Autowired
//    private UserMapper userMapper;
//    @Autowired
//    private WorkMapper workMapper;
//    @Autowired
//    private ProjectMapper projectMapper;
//    @Autowired
//    private SkillMapper skillMapper;
//    @Autowired
//    private EducationMapper educationMapper;
//
//    @Transactional
//    @Override
//    public int improveResume(ImproveResumeParamOUT improveResumeParamOUT) {
//        User user = improveResumeParamOUT.getUser();
//
//        //获取当前用户
//        User currentUser = SecurityUtils.getCurrentUser();
//        UserExample userExample = new UserExample();
//        //根据当前用户的id号 进行信息更新
//        userExample.createCriteria().andIdEqualTo(currentUser.getId());
//
//        if(userMapper.updateByExampleSelective(user,userExample) <= 0){
//            return 0;
//        }
//
//        List<Work> workList = improveResumeParamOUT.getWorkList();
//        if (workList != null && workList.size()>0)
//        for (Work work : workList){
//            Work w = new Work();
//            w.setUserId(currentUser.getId());
//            w.setCompanyName(work.getCompanyName());
//            w.setPosition(work.getPosition());
//            w.setIntroduce(work.getIntroduce());
//            if (workMapper.insertSelective(w) <= 0){
//                return 0;
//            }
//        }
//
//        List<Project> projectList = improveResumeParamOUT.getProjectList();
//        if (projectList != null && projectList.size() > 0){
//            for (Project project : projectList){
//                Project p = new Project();
//                p.setUserId(currentUser.getId());
//                p.setIntroduce(project.getIntroduce());
//                p.setPosition(project.getPosition());
//                p.setProjectName(project.getProjectName());
//                if (projectMapper.insertSelective(p) <= 0) {
//                    return 0;
//                }
//            }
//        }
//
//        List<Skill> skillList = improveResumeParamOUT.getSkillList();
//        if (skillList != null && skillList.size()>0){
//            for (Skill skill : skillList){
//                Skill s = new Skill();
//                s.setUserId(currentUser.getId());
//                s.setLevel(skill.getLevel());
//                if (skillMapper.insertSelective(s) <= 0){
//                    return 0;
//                }
//            }
//        }
//
//        Education education = improveResumeParamOUT.getEducation();
//        EducationExample educationExample = new EducationExample();
//        educationExample.createCriteria().andUserIdEqualTo(currentUser.getId());
//        if (education != null)
//        {
//            if (educationMapper.updateByExampleSelective(education,educationExample) <= 0){
//                return 0;
//            }
//        }
//
//        return 1;
//    }
//}
